{% extends 'base/base.html' %}

{% block title %}确认移除成员 - {{ project.name }} - 多用户报警系统{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h2 class="h4">
                    <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> 确认移除成员
                </h2>
            </div>
            <div class="card-body">
                <div class="alert alert-warning" role="alert">
                    <i class="fa fa-exclamation-circle" aria-hidden="true"></i> 警告：移除成员后，该成员将无法访问此项目。
                </div>
                <p class="mb-4">您确定要从项目 <strong>{{ project.name }}</strong> 中移除成员 <strong>{{ member_to_remove.user.username }}</strong> 吗？</p>
                <div class="mb-4">
                    <div class="p-3 bg-light rounded">
                        <p class="mb-0"><strong>用户名：</strong>{{ member_to_remove.user.username }}</p>
                        <p class="mb-0"><strong>角色：</strong><span class="role-badge role-{{ member_to_remove.role }}">{{ member_to_remove.get_role_display }}</span></p>
                        <p class="mb-0"><strong>加入时间：</strong>{{ member_to_remove.joined_at|date:"Y年m月d日 H:i" }}</p>
                    </div>
                </div>
                <form method="post">
                    {% csrf_token %}
                    <div class="d-flex gap-2">
                        <button type="submit" class="btn btn-danger">
                            <i class="fa fa-trash" aria-hidden="true"></i> 确认移除
                        </button>
                        <a href="{% url 'projects:project_members' project.id %}" class="btn btn-secondary">
                            <i class="fa fa-times" aria-hidden="true"></i> 取消
                        </a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block javascript %}
<script>
    // 添加页面加载动画效果
    document.addEventListener('DOMContentLoaded', function() {
        // 为移除按钮添加确认提示
        const removeButton = document.querySelector('.btn-danger');
        if (removeButton) {
            removeButton.addEventListener('click', function(e) {
                if (!confirm('确定要移除成员 "{{ member_to_remove.user.username }}" 吗？')) {
                    e.preventDefault();
                }
            });
        }
    });
</script>
{% endblock %}